<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery.min.js"></script>
    <script>
        $(function(){
            $("button").click(function(){
                console.log($(this).attr("data-id"));
                console.log($(this).attr("data-name"));
            });
        })
    </script>
</head>
<body>
    <button id="btn" data-id="1" data-name="admin">自定义属性</button>
</body>
</html>